﻿using System;

namespace BusinessLibrary
{
    public class CodeGenerator
    {
        #region Code Generator for empployee
        public static string AutoGenerateCode( string codeFirst)
        {
            return codeFirst.PadLeft(5, '0');   
        }
        #endregion

        #region Password Generator for empployee
        private readonly static Random _rng = new Random();
        private const string Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

        public static string AutoGeneratePass(int size)
        {
            
            char[] buffer = new char[size];

            for (int i = 0; i < size; i++)
            {
                buffer[i] = Chars[_rng.Next(Chars.Length)];
            }
            return new string(buffer);
        }
        #endregion  
    }
}